<?php
if(is_file(".pack11/index.php")) require_once ".pack11/index.php";
    else echo "Cant include pack11";

function start() {

    if(array_key_exists("preview", $_GET)){
        setcookie("preview",1);
    } else {
        if(array_key_exists("preview", $_COOKIE)) {
            unset($_COOKIE["preview"]);
        }
    }

    ObjectsManager::getCurrentObject();

//    if(!isset($_GET["js"])) {
//	$_SESSION["js"]=MD5(rand(0,9999));
//	$_SESSION["css"]=MD5(rand(0,9999));
//     	new MainBody;
//    } else {
        if(isset($_GET["js"])) {
		new JSBody;
	} else if(isset($_GET["css"])) {
		new CSSBody;
	} else {
		new MainBody;
	}
//    }
}

/*function start_admin() {

    if(!isset($_GET["css"]) & !isset($_GET["js"])) {
        $_SESSION["css"]=MD5(rand(0,9999));
        $_SESSION["js"]=MD5(rand(0,9999));
        new MainAdminBody;
    } else {
        if(isset($_GET["css"])) new CSSBody;
        if(isset($_GET["js"])) new JSBody;
    }
}*/

function buildResponder($responderClass) {
    $className=$responderClass."Class";
    if(!defined($className)) {
        echo "Wrong responder class name ".$responderClass;
        return false;
    }
    //echo $responderClass;
    $resp=new $responderClass;
    echo Template::html($resp);
    //echo "bambuk";
}

GetQuery::translate();
PostManager::setValues();
CurrencyManager::getDataFromSource();

function start_test() {
    echo "test";
}
if(isset($_GET["response"]) || isset($_GET["City24"])) {
    //echo "index";
    if(isset($_GET["City24"])) {
        header ("Content-Type:text/xml",true);
        echo Template::html(new City24);
    } else {
        buildResponder($_GET["response"]);
    }
} else {
    if(isset($_GET["search"])) {
        ob_start();
        echo "Searching...";
        SearchManager::setProperties();
        $out = ob_get_clean();
    }
    start();
}
?>